/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.wechat.dao.tmessage;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.thinkgem.jeesite.common.persistence.BaseDao;
import com.thinkgem.jeesite.common.persistence.BaseDaoImpl;
import com.boxin.ims.modules.wechat.entity.tmessage.UserMessageTemplate;

/**
 * 用户消息模板DAO接口
 * @author 肖乾
 * @version 2014-09-11
 */
public interface UserMessageTemplateDao extends UserMessageTemplateDaoCustom, CrudRepository<UserMessageTemplate, Long> {

	@Modifying
	@Query("delete from  UserMessageTemplate   where id = ?1")
	public int deleteById(Long id);
	
	
	@Query("from  UserMessageTemplate   where user.id = ?1 and businessMessageTemplate.code=?2")
	public UserMessageTemplate getUserMessageTemplateByBid(Long userId,String bCode);
	
}

/**
 * DAO自定义接口
 * @author 肖乾
 */
interface UserMessageTemplateDaoCustom extends BaseDao<UserMessageTemplate> {

}

/**
 * DAO自定义接口实现
 * @author 肖乾
 */
@Component
class UserMessageTemplateDaoImpl extends BaseDaoImpl<UserMessageTemplate> implements UserMessageTemplateDaoCustom {

}
